<!doctype html>
<html lang="">
  <head>
    <meta charset="utf-8">
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>kangai</title>

    <link rel="apple-touch-icon" href="apple-touch-icon.png">
    <!-- Place favicon.ico in the root directory -->

    <!-- build:css styles/vendor.css -->
    <!-- bower:css -->
    <!-- endbower -->
    <!-- endbuild -->

    <!-- build:css styles/main.css -->
    <link rel="stylesheet" href="lib/layui/css/layui.css">
    <link rel="stylesheet" href="styles/main.css">
    <!-- endbuild -->

  </head>
  <body class="layui-layout-body">

    <div class="layui-layout layui-layout-admin layui-layout_ka">
      <div class="layui-header">
        <ul class="h-menus">
          <li>
            <img src="./images/user.png" class="icon">
            <span id="h-user"></span>
          </li>
          <li id="btn-exit" class="btn-exit">
            <img src="./images/exit.png" class="icon">
            退出
          </li>
        </ul>
      </div>
      <div class="layui-side">
        <div class="bar-container layui-bg-green">
          <img id="logo" src="images/logo.png" class="logo">
          <div class="menus" id="menus">
            <a class="menu " href="./index.html">
              <img src="images/menu-index.png" class="icon">
              <p>营养筛查</p>
            </a>
            <a class="menu" href="./nutritiveriskView.html">
              <img src="images/menu-nutritiveriskView.png" class="icon">
              <p>营养看板</p>
            </a>
            <a class="menu active" href="./censusView.html">
              <img src="images/menu-censusView.png" class="icon">
              <p>统计查询</p>
            </a>
          </div>
        </div>
      </div>
      <div class="layui-body">
        <div class="layui-container-full">
          <div class="layui-row page-header">
            <div class="layui-col-xs8">
              <div class="page-title h3">
                营养驾驶舱
              </div>
              <div class="layui-btn-group">
                <a href="./censusView.html" class="layui-btn-hollow">营养风险统计</a>
                <a href="./censusView2.html" class="layui-btn-hollow active">复核工作量统计</a>
              </div>
            </div>
            <div class="layui-col-xs4">
              <div class="time-board">
                <div class="time-header">
                  <div class="time" id="time"></div>
                  <div>
                    <p class="year" id="year"></p>
                    <p class="week" id="week"></p>
                  </div>
                </div>
                <div class="time-footer">
                  <img src="images/logo2.png" >
                </div>
              </div>
            </div>
          </div>


          <div class="layui-row">
            <div class="layui-col-xs12">
              <div class="chart-board">
                <div class="board-header layui-form d-flex">
                <div class="layui-form-item flex m-0">
                  <label class="layui-form-label block text-left ">营养干预占比和营养治疗人次变化</label>
                </div>
                <div class="layui-form-item m-0">
                  <label class="layui-form-label">护士姓名</label>
                  <div class="layui-input-inline">
                    <select id="nursename" lay-filter="nursename">
                      <option value="">护士姓名</option>
                    </select>
                  </div>
                </div>
                <div class="layui-form-item m-0">
                  <label class="layui-form-label">患者姓名</label>
                  <div class="layui-input-inline">
                    <select id="riskname" lay-filter="riskname">
                      <option value="">患者姓名</option>
                    </select>
                    <!--<input type="text"  id="riskname" placeholder="请输入标题"  class="layui-input">

                    <ul class="user-list">
                    </ul>-->
                  </div>
                </div>
              </div>
                <div class="board-body">
                  <table id="tableContent"></table>
                  <table id="tablePage"></table>
                </div>
              </div>
            </div>

          </div>
        </div>
      </div>
      <div class="layui-footer text-center t-gray" id="copyright"></div>
    </div>


    <!-- build:js scripts/vendor.js -->
    <!-- bower:js -->
    <!-- endbower -->
    <!-- endbuild -->


    <script src="lib/layui/layui.js" charset="utf-8"></script>
    <script src="scripts/main.js"></script>
    <script src="lib/echarts.js" charset="utf-8"></script>



    <script type="text/javascript">

      layui.use(['layer', 'form', 'table', 'laypage', 'layer', 'element', 'httpService', 'httpRouter', 'common'], function(){
        var table = layui.table,
          laypage = layui.laypage,
          layer = layui.layer,
          form = layui.form,
          common = layui.common,
          element = layui.element,
          $ = layui.jquery,
          http = layui.httpService;
        httpRouter = layui.httpRouter;

        var userList = [];
        var page = 1;
        common.init();
        common.getMenus(2);

        form.on('select(nursename)', function(data){
          page = 1;
          getreviewchange(page);
        });
        form.on('select(riskname)', function(data){
          page = 1;
          getreviewchange(page);
        });

        /*获取复核人列表*/
        function getReviewuserList() {
          http.get(httpRouter.reviewuserinfo,{},function (res) {
            $.each(res.records,function(index,obj){
              $('#nursename').append('<option value="'+obj.userId+'">'+obj.userName+'</option>');
              form.render()
            });

          });
        }
        getReviewuserList();
        /*获取患者姓名列表*/
        function getUserList() {
          http.get(httpRouter.userinfo,{},function (res) {
            userList = res.records;
            $.each(res.records,function(index,obj){
              $('#riskname').append('<option value="'+obj.userId+'">'+obj.userName+'</option>');
              form.render()
            });

          });
        }
        getUserList();


        function getreviewchange(page) {

          var nursename = $('#nursename').val() || "";
          var riskname = $('#riskname').val() || "";
          var param = "nursename="+nursename
            +"&riskname="+riskname
            +"&page="+page
            +"&limit="+10
            +"&start="+0;

          http.post(httpRouter.reviewchange,param,function (res) {
            reviewchange(res);
          });
        }
       getreviewchange(page);

        function reviewchange(data) {
          table.render({
            elem: '#tableContent'
            ,data:data.records
            ,cols: [[
              {field:'riskId', width:80, title: 'No.'}
              ,{field:'nurseName', width:100, title: '护士姓名'}
              ,{field:'riskName', width:80, title: '患者姓名'}
              ,{field:'checkResults', title: '复核结果',templet:'<span>{{d.checkResults == 1 ? "与筛查结果一致" : "有风险"}}</span>'}
            ]]
          });

          laypage.render({
            elem: 'tablePage'
            ,limit:10
            ,count: parseInt(data.total)
            ,curr:page
            ,layout: [ 'prev', 'page', 'next', 'count', 'refresh']
            ,jump: function(obj, first){
              //obj包含了当前分页的所有参数，比如：
              //首次不执行
              if(!first){
                page = obj.curr;
                getreviewchange(obj.curr);
              }

            }
          });

        }





      });
    </script>
  </body>
</html>



